import Vue from 'vue'
import Router from 'vue-router'
import logIn from 'pages/logIn.vue'
import home from 'pages/home.vue'
import wallUser from 'pages/wallUser.vue'
import index from 'pages/index.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      // https://www.cnblogs.com/hanshuai/p/9930063.html
      path: '/home',
      name: 'home',
      component: home,
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
      children: [
        {
          path: '/home/wallUser',
          name: 'wallUser',
          component: wallUser
        }, {
          path: '/home/index',
          name: 'index',
          component: index
        }
      ]
    },
    {
      path: '/login',
      name: 'logIn',
      component: logIn
    },
    {
      path: '/',
      name: '/',
      component: logIn
    }
  ]
})
